<!DOCTYPE html>
<html>
<head>
    <title>箱子管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="/css/bootstrap-responsive.css" rel="stylesheet" media="screen">
    <link rel="stylesheet" type="text/css" href="/css/style.css">
    <script src="/lib/jq/jquery-2.1.1.min.js"></script>
    <script src="/lib/jq/bootstrap.min.js"></script>
    <script type="text/javascript" src="/js/edit.js"></script>
    <script type="text/javascript">
        var doorLayout = [
            ["一行两列", "两行一列"],
            ["两行两列", "一行四列", "四行一列"],
            ["三行两列", "两行三列"],
            ["四行两列", "两行四列"],
            ["两行五列","五行两列"],
            ["三行四列","四行三列"]
        ];

        function getNum() {
            var doorsnum = $('#first').val();
            var doorslayout = $('#secend').val();

            var layout=doorsnum/2-1;
            var shu=doorLayout[layout];
            var html="<option value='0'>请选择箱子布局</option>";
            $.each(shu,function(key,val){
                html+="<option value='"+val+"'>"+val+"</option>";
            });
            $("#secend").html(html);
        }
    </script>
</head>
<body style="margin:15px;">
<div id="lert"></div>
<!--<% if (success) { %>-->
<!--<div class="alert alert-success">-->
    <!--<h4><%= success %></h4>-->
<!--</div>-->
<!--<% } %>-->
<!--<% if (error) { %>-->
<!--<div class="alert alert-error">-->
    <!--<h4><%= error %></h4>-->
<!--</div>-->
<!--<% } %>-->
<legend>更新箱子资料</legend>
<form onsubmit="return check()" style="margin-left: 25%" action="/box_management/edit" method="post" name="form1" class="form-horizontal">
    <div style="margin-bottom:25px;"><span style="color:red;">*</span>项为必填项</div>
    <div class="control-group">
        <label class="control-label"><span style="color:red;">*</span>Sim卡号：</label>
        <div class="controls">
            <select name="sim" id="sim">
                <option value="0"><%=sim%></option>
                <%for(var i=0;i<simdatas.length;i++){%>
                <option value="<%=simdatas[i].sim%>"><%=simdatas[i].sim%></option>
                <%}%>
            </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">购买人：</label>
        <div class="controls">
            <select name="buyer" id="buyer">
                <%if(buyer=="请选择用户名"){%>
                <option value="0"><%=buyer%></option>
                <%for(var i=0;i<buyerdatas.length;i++){%>
                <option value="<%=buyerdatas[i].buyer%>"><%=buyerdatas[i].buyer%></option>
                <%}}else{%>
                <option value="<%=buyer%>"><%=buyer%></option>

                <%for(var i=0;i<buyerdatas.length;i++){%>
                <%if(buyerdatas[i].buyer==buyer){%>
                <option value="0">请选择用户名</option>
                <%}else{%>
                <option value="<%=buyerdatas[i].buyer%>"><%=buyerdatas[i].buyer%></option>
                <%}}}%>
            </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">箱子贴条位置：</label>
        <div class="controls">
            <select name="code_layout" id="country">
                <option value="0"><%=boxdatas[0].code_layout%></option>
                <%if(boxdatas[0].code_layout=='左上角'){%>
                <option value="右上角">右上角</option>
                <%}else{%>
                <option value="左上角">左上角</option>
                <%}%>
            </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label"><span style="color:red;">*</span>格子数量：</label>
        <div class="controls">
            <select name="door_num"  onChange="getNum()" id="first">
                <option value="0"><%=boxdatas[0].doors_num%></option>
                <option value="2">2</option>
                <option value="4">4</option>
                <option value="6">6</option>
                <option value="8">8</option>
                <option value="10">10</option>
                <option value="12">12</option>
            </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label"><span style="color:red;">*</span>箱子布局：</label>
        <div class="controls">
            <select id="secend" name="box_layout">
                <option value="<%=boxdatas[0].box_layout%>"><%=boxdatas[0].box_layout%></option>
            </select>
        </div>
    </div>
    <input type="hidden" name="boxid" value="<%=boxid%>"/>
    <input type="hidden" name="osim" value="<%=sim%>"/>
    <input type="hidden" name="ocode_layout" value="<%=boxdatas[0].code_layout%>"/>
    <input type="hidden" name="odoors_num" value="<%=boxdatas[0].doors_num%>"/>
    <input type="hidden" name="obox_layout" value="<%=boxdatas[0].box_layout%>"/>
    <div class="control-group">
        <div class="controls">
            <input type="submit" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;" value="提交" id="sub_btn">
        </div>
    </div>
</form>
</body>
</html>